package demo2;
//Writer.java
class Writer implements Cloneable{
    public String author="张三";


    @Override
    protected Object clone() throws CloneNotSupportedException {
        return super.clone();
    }
}
//Book.java
public class Book implements Cloneable {
    public String name="查理九世";
    public double money=9.9;
    public Writer writer=new Writer();

    public Book() {
    }

    @Override
    protected Object clone() throws CloneNotSupportedException {
       Book tmp=(Book)super.clone();
       tmp.writer=(Writer) this.writer.clone();
       return tmp;
    }

}
